import mujoco
import mujoco.viewer
import numpy as np
from os.path import dirname, join

# 加载模型
model = mujoco.MjModel.from_xml_path(join(dirname(__file__),'dp.xml')) 
data = mujoco.MjData(model)

with mujoco.viewer.launch_passive(model, data) as viewer:

    mujoco.mj_step(model, data)  # 更新物理状态

    while viewer.is_running():
        # 步进仿真
        mujoco.mj_step(model, data)
        viewer.sync()